﻿#ifndef AUDIODATADISPATCHER_H
#define AUDIODATADISPATCHER_H

#include <QObject>
#include <QMutex>

#include "common/LoopBuffer.h"
#include "common/AudioParam.h"

class AVFileStoreAAC;
class AVFileStoreMP3;

extern "C"
{
#include "libavformat/avformat.h"
};

class AudioDataDispatcher : public QObject
{
    Q_OBJECT
public:
    AudioDataDispatcher(QObject *parent = 0);
    ~AudioDataDispatcher();

public slots:
    void acceptMicData(AVFrame *frame);
    void acceptSpeakerData(AVFrame *frame);

    void acceptMacMicData(AVFrame *frame);

    void run();
private:
    QList<AVFrame*> m_micList;
    QList<AVFrame*> m_speakList;

    LoopBuffer m_micBuffer;
    LoopBuffer m_spkBuffer;

    AVFileStoreAAC *m_aac = 0;
    AVFileStoreMP3 *m_mp3 = 0;
};

#endif // AUDIODATADISPATCHER_H
